﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using MobMentality;
using MobMentality.Social;

namespace MobMentality
{
    class HUD
    {
        Texture2D hudBG;
        Texture2D selected;
        Texture2D person;
        ContentManager content;
        IGroupController group;

        SpriteFont gameFont;


        public HUD(ContentManager content)
        {
            this.content = content;
            hudBG = content.Load<Texture2D>("HUD_back");
            selected = content.Load<Texture2D>("HUD_blank");
            person = content.Load<Texture2D>("Person");
            gameFont = content.Load<SpriteFont>("GameFont");
        }

        public void select(IGroupController group)
        {
            this.group = group;
        }

        public void selectInciter()
        {
            selected = content.Load<Texture2D>("HUD_I");
        }

        public void selectPerson()
        {
            selected = content.Load<Texture2D>("HUD_person");
        }

        public void clear()
        {
            selected = content.Load<Texture2D>("HUD_blank");
        }

        public void Draw(SpriteBatch spriteBatch)
        {
            
            Vector2 pos;
            pos.X = 0;
            pos.Y = 650;

            spriteBatch.Draw(hudBG, pos, Color.Black);
            spriteBatch.Draw(selected, new Vector2(1170,675), Color.Red);



            if (group != null)
            {
                int row = 620;
                int col = 0;

                for (int i = 0; i < group.NumMembers; i++)
                {
                    col = (i % 4) * 70;
                    if (i % 4 == 0)
                    {
                        row += 60;
                        col = 0;
                    }
                    spriteBatch.Draw(person, new Vector2(800 + col, row), Color.Red);
                }

                String a = "Current Distraction: ";
                a += group.Distracted.ToString();
                spriteBatch.DrawString(gameFont, a, new Vector2(200, 675), Color.White);

            }

        }
    }
}
